 ///
 /// @file    associative_container5.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-03-08 15:53:34
 ///
 
#include <iostream>
#include <map>
#include <string>

using std::cout;
using std::endl;
using std::map;
using std::multimap;
using std::string;
using std::pair;

int main(void)
{
	pair<int, string> pairArr[4] = {
		pair<int, string>(7, "G"),
		pair<int, string>(3, "C"),
		pair<int, string>(5, "E"),
		pair<int, string>(1, "A")
	};
	
	pair<int, string> pairArr2[4] = {
		pair<int, string>(2, "B"),
		pair<int, string>(4, "D"),
		pair<int, string>(6, "F"),
		pair<int, string>(1, "X")
	};

	map<int, string> mapIntStr(pairArr, pairArr + 4);
	mapIntStr.insert(pairArr2, pairArr2 + 4);

	map<int, string>::iterator mit;
	for(mit = mapIntStr.begin(); mit != mapIntStr.end(); ++mit)
	{
		cout << (*mit).first << "-->" 
			 << (*mit).second << endl;
	}

	cout << endl << endl;

	multimap<int, string> mmapIntStr(pairArr, pairArr + 4);
	mmapIntStr.insert(pairArr2, pairArr2 + 4);

	multimap<int, string>::iterator mmit;
	for(mmit = mmapIntStr.begin(); mmit != mmapIntStr.end(); ++mmit)
	{
		cout << (*mmit).first << "-->" 
			 << (*mmit).second << endl;
	}


}
